<?php
/**
 * Created by PhpStorm.
 * User: DaibiDaddy
 * Date: 2016/6/3
 * Time: 14:59
 */

namespace App\Setting\LazyCommon;

use App\Model\LazyCommon\WechatReplyModel;

class WechatReplySetting{

    /*手动获取的配置项*/
    public $catType = "level";//Options:level snake
    public $entityCnName = "智能回复";
    public $table = "WechatReply";
    public $editKeys = array("find","reply","orders","status");
    public $perPage = 1000;

    /*自动获取的配置项*/
    public $entity;
    public $bundleName;
    public $entityName;
    public $SettingPath;
    public $entityPath;
    public $modelPath;
    public $doctrine;

    public function __construct($doctrine)
    {
        $this->bundleName = "App";
        $this->entityName = str_replace("\\","",str_replace("Setting","",str_replace(__NAMESPACE__,"",__CLASS__)));
        $this->SettingPath = __CLASS__;
        $this->entityPath = str_replace($this->entityName."Entity",$this->entityName,str_replace("Setting","Entity",str_replace("\\LazyCommon","",__CLASS__)));
        $this->entity = new $this->entityPath();
        $this->modelPath = str_replace("Setting","Model",__CLASS__);
        $this->doctrine = $doctrine;
    }

    public function listConfig()
    {
        $default = array();
        $default["Wechat_Reply AS WechatReply"]["select"] = array("id","find","reply","orders","status");
        $default["Wechat_Reply AS WechatReply"]["search"] = array("find","reply");
        $default["Wechat_Reply AS WechatReply"]["condition"] = array("status");
        $default["Wechat_Reply AS WechatReply"]["orderBy"] = array("id"=>"DESC");

        $join = array();

        return array(
            "default"   => $default,
            "joins"     => $join,
        );
    }

    public function formConfig()
    {
        $config["find"] = array(
            "label"     =>"关键词",
            "showType"  =>"text",
            "dataType"  =>"required",
            "option"    => array()
        );

        $config["reply"] = array(
            "label"     =>"回复",
            "showType"  =>"textarea",
            "dataType"  =>"",
            "option"    =>  array()
        );
        $config["orders"] = array(
            "label"     =>"排序",
            "showType"  =>"text",
            "dataType"  =>"",
            "option"    => array()
        );
        return $config;
    }
}